# 汉诺塔问题 打印n层汉诺塔从最左边移动到最右边的全部过程
# (1)将 n-1 层从左边移到中间
# (2)将 n 层从左边移到右边
# (3)将 n-1 层从中间移到右边

def print_hanoi(n: int):
    process(n, "left", "right", "mid")


def process(n: int, mvfrom, mvto, help):
    if n == 1:
        print("move 1 from {} to {}".format(mvfrom, mvto))
        return
    process(n-1, mvfrom, help, mvto)
    print("move {} from {} to {}".format(n, mvfrom, mvto))
    process(n-1, help, mvto, mvfrom)


if __name__ == "__main__":
    print_hanoi(3)
